Skip to content

HDDS-15148. Prevent 404 when toggling between Old/New UI on UI-exclusive routes#10168

Open
chihsuan wants to merge 2 commits intoapache:masterfrom
chihsuan:HDDS-15148
Open

HDDS-15148. Prevent 404 when toggling between Old/New UI on UI-exclusive routes#10168
chihsuan wants to merge 2 commits intoapache:masterfrom
chihsuan:HDDS-15148

Conversation

@chihsuan
Copy link
Copy Markdown
Contributor

@chihsuan chihsuan commented May 1, 2026

What changes were proposed in this pull request?

Recon's Old and New UIs share most routes but have asymmetric paths: /Capacity exists only in the New UI, /MissingContainers only in the Old UI. The "Switch to" toggle in the header previously swapped the active routes table without rewriting the URL hash, so users on a UI-exclusive path were dropped onto the bottom <Route component={NotFound}> fallback after toggling, producing a "404 Page Not Found :(" screen.

This change validates the current path against the destination UI's route table on toggle. If the path is absent, the toggle:

  1. Redirects the URL hash to /Overview so the destination UI lands on its dashboard
  2. Shows an antd message.info toast (4s) explaining where the view actually lives
  3. Persists enableOldUI to sessionStorage as before (no behavior change there)

Both directions are covered: New → Old on /Capacity (the case the Jira filed) and Old → New on /MissingContainers (a symmetric pre-existing bug with the same root cause). Parameterized routes are filtered when checking route-table membership so the v1 /:NotFound catch-all does not falsely match every path.

/Capacity was also added to the v2 breadcrumb name map so the toast text and breadcrumb display both refer to it as "Cluster Capacity".

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-15148

How was this patch tested?

Manually verified using the Recon UI dev server (pnpm dev under hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web).

Test 1 — New → Old on a New-UI-only path (the case the Jira filed)

  1. Open http://localhost:3000/#/Capacity while on the New UI.
  2. Click the "Switch to Old UI" toggle in the header.
  3. Verify the URL flips to #/Overview, the Old UI Overview renders, and an info toast appears: "The 'Cluster Capacity' view is only available in the New UI. We've returned you to the Overview dashboard."

Before:

Screen.Recording.2026-05-01.at.8.31.10.PM.mov

After:

Screen.Recording.2026-05-01.at.9.08.01.PM.mov

Test 2 — Old → New on an Old-UI-only path (symmetric reverse case)

  1. While on the Old UI, navigate to http://localhost:3000/#/MissingContainers.
  2. Click the "Switch to New UI" toggle.
  3. Verify the URL flips to #/Overview, the New UI Overview renders, and the toast text reflects the Old UI as the source: "The 'Missing Containers' view is only available in the Old UI. We've returned you to the Overview dashboard."

Before:

Screen.Recording.2026-05-01.at.8.37.56.PM.mov

After:

Screen.Recording.2026-05-01.at.9.08.22.PM.mov

Test 3 — No regression on shared paths

  1. Navigate to http://localhost:3000/#/Volumes (or any path that exists in both UIs).
  2. Toggle Old/New back and forth.
  3. Verify the page stays on /Volumes, no toast, no redirect — same behavior as before this patch.
Screen.Recording.2026-05-01.at.9.25.30.PM.mov

Test 4 — Non-existent / typo'd path

  1. Navigate to http://localhost:3000/#/RandomGarbage.
  2. Click the toggle.
  3. Verify a silent redirect to #/Overview with no misleading "only available in..." toast (the path did not exist in either UI, so no source-UI message is meaningful).

chihsuan added 2 commits May 1, 2026 21:15
…ive routes

Recon's Old and New UIs share most routes but have asymmetric paths:
/Capacity exists only in New UI, /MissingContainers only in Old UI.
The "Switch to" toggle previously swapped the routes table without
rewriting the URL hash, so users on a UI-exclusive path saw a 404
after toggling.

Validate the current path against the destination route table on
toggle. If absent, redirect to /Overview and show an info toast
explaining where the view actually lives. Skip parameterized routes
when checking membership so the v1 /:NotFound catch-all does not
falsely match every path.
@chihsuan chihsuan marked this pull request as ready for review May 1, 2026 14:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Recon UI’s Old/New toggle behavior so switching UIs from a route that only exists in one UI no longer drops users into the 404 fallback. Instead, the toggle validates the current hash path against the destination UI’s route table and redirects to a safe default when needed, with a brief informational toast.

Changes:

  • Add UI-toggle handling that detects UI-exclusive routes, redirects to #/Overview when the destination UI can’t serve the current path, and shows an antd message.info explanation when applicable.
  • Add /Capacity to the v2 breadcrumb name map so breadcrumb/toast text uses “Cluster Capacity”.
  • Centralize the fallback path (/Overview) into a constant used by both toggle logic and the root redirect.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/constants/breadcrumbs.constants.tsx Adds breadcrumb label for the v2-only /Capacity route (“Cluster Capacity”).
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/app.tsx Implements route-table validation + redirect/toast behavior when toggling between UIs on UI-exclusive paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants